<%-- 
    Document   : form
    Created on : Dec 6, 2013, 9:41:46 PM
    Author     : Sonumimatho
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="model.UserBean" %>
<%@page import="java.sql.*"%>
<%@page import="database.DBClass"%>
<%@page import="java.util.List"%>
<link rel="stylesheet" href="Admin/css/bootstrap.css">
<%
    if (session.getAttribute("userName") == null) {

        RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
        rd.forward(request, response);
    }

    UserBean bean;
    bean = new UserBean();
    if (request.getAttribute("error") != null) {
        bean = (UserBean) request.getAttribute("error");
    }
    if (request.getAttribute("updateuser") != null) {
        bean = (UserBean) request.getAttribute("updateuser");
    }
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tambah Data Senjata</title>
        <link rel="stylesheet" href="Admin1/css/screen.css" type="text/css" media="screen" title="default" />

        <script src="Admin1/js1/jquery/jquery-1.4.1.min.js" type="text/javascript"></script>

        <!--  checkbox styling script -->
        <script src="Admin1/js1/jquery/ui.core.js" type="text/javascript"></script>
        <script src="Admin1/js1/jquery/ui.checkbox.js" type="text/javascript"></script>
        <script src="Admin1/js1/jquery/jquery.bind.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function() {
                $('input').checkBox();
                $('#toggle-all').click(function() {
                    $('#toggle-all').toggleClass('toggle-checked');
                    $('#mainform input[type=checkbox]').checkBox('toggle');
                    return false;
                });
            });
        </script>  


        <![if !IE 7]>

        <!--  styled select box script version 1 -->
        <script src="Admin1/js1/jquery/jquery.selectbox-0.5.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.styledselect').selectbox({inputClass: "selectbox_styled"});
            });
        </script>


        <![endif]>

        <!--  styled select box script version 2 --> 
        <script src="Admin1/js1/jquery/jquery.selectbox-0.5_style_2.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.styledselect_form_1').selectbox({inputClass: "styledselect_form_1"});
                $('.styledselect_form_2').selectbox({inputClass: "styledselect_form_2"});
            });
        </script>

        <!--  styled select box script version 3 --> 
        <script src="Admin1/js1/jquery/jquery.selectbox-0.5_style_2.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.styledselect_pages').selectbox({inputClass: "styledselect_pages"});
            });
        </script>

        <!--  styled file upload script --> 
        <script src="Admin1/js1/jquery/jquery.filestyle.js" type="text/javascript"></script>
        <script type="text/javascript" charset="utf-8">
            $(function() {
                $("input.file_1").filestyle({
                    image: "images/forms/upload_file.gif",
                    imageheight: 29,
                    imagewidth: 78,
                    width: 300
                });
            });
        </script>

        <!-- Custom jquery scripts -->
        <script src="Admin1/js1/jquery/custom_jquery.js" type="text/javascript"></script>

        <!-- Tooltips -->
        <script src="Admin1/js1/jquery/jquery.tooltip.js" type="text/javascript"></script>
        <script src="Admin1/js1/jquery/jquery.dimensions.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function() {
                $('a.info-tooltip ').tooltip({
                    track: true,
                    delay: 0,
                    fixPNG: true,
                    showURL: false,
                    showBody: " - ",
                    top: -35,
                    left: 5
                });
            });
        </script> 

        <!--  date picker script -->
        <link rel="stylesheet" href="Admin1/css/datePicker.css" type="text/css" />
        <script src="Admin1/js1/jquery/date.js" type="text/javascript"></script>
        <script src="Admin1/js1/jquery/jquery.datePicker.js" type="text/javascript"></script>
        <script type="text/javascript" charset="utf-8">
            $(function()
            {

                // initialise the "Select date" link
                $('#date-pick')
                        .datePicker(
                        // associate the link with a date picker
                                {
                                    createButton: false,
                                    startDate: '01/01/2005',
                                    endDate: '31/12/2020'
                                }
                        ).bind(
                                // when the link is clicked display the date picker
                                'click',
                                function()
                                {
                                    updateSelects($(this).dpGetSelected()[0]);
                                    $(this).dpDisplay();
                                    return false;
                                }
                        ).bind(
                                // when a date is selected update the SELECTs
                                'dateSelected',
                                function(e, selectedDate, $td, state)
                                {
                                    updateSelects(selectedDate);
                                }
                        ).bind(
                                'dpClosed',
                                function(e, selected)
                                {
                                    updateSelects(selected[0]);
                                }
                        );

                        var updateSelects = function(selectedDate)
                        {
                            var selectedDate = new Date(selectedDate);
                            $('#d option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
                            $('#m option[value=' + (selectedDate.getMonth() + 1) + ']').attr('selected', 'selected');
                            $('#y option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
                        }
                        // listen for when the selects are changed and update the picker
                        $('#d, #m, #y')
                                .bind(
                                'change',
                                function()
                                {
                                    var d = new Date(
                                            $('#y').val(),
                                            $('#m').val() - 1,
                                            $('#d').val()
                                            );
                                    $('#date-pick').dpSetSelected(d.asString());
                                }
                        );

                        // default the position of the selects to today
                        var today = new Date();
                        updateSelects(today.getTime());

                        // and update the datePicker to reflect it...
                        $('#d').trigger('change');
                    });
        </script>

        <!-- MUST BE THE LAST SCRIPT IN <HEAD></HEAD></HEAD> png fix -->
        <script src="Admin1/js1/jquery/jquery.pngFix.pack.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $(document).pngFix( );
            });
        </script>

    </head>
    <body>

        <!-- Start: page-top-outer -->
        <div id="page-top-outer">    

            <!-- Start: page-top -->
            <div id="page-top">

                <!-- start logo -->
                <div id="logo">
                    <a href=""><img src="images/shared/logo.png" width="156" height="40" alt="" /></a>
                </div>
                <!-- end logo -->

                <!--  start top-search -->
                <div id="top-search">
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td><input type="text" value="Search" onblur="if (this.value == '') {
                    this.value = 'Search';
                }" onfocus="if (this.value == 'Search') {
                    this.value = '';
                }" class="top-search-inp" /></td>
                            <td>

                                <select  class="styledselect">
                                    <option value=""> All</option>
                                    <option value=""> Products</option>
                                    <option value=""> Categories</option>
                                    <option value="">Clients</option>
                                    <option value="">News</option>
                                </select> 

                            </td>
                            <td>
                                <input type="image" src="images/shared/top_search_btn.gif"  />
                            </td>
                        </tr>
                    </table>
                </div>
                <!--  end top-search -->
                <div class="clear"></div>

            </div>
            <!-- End: page-top -->

        </div>
        <!-- End: page-top-outer -->

        <div class="clear">&nbsp;</div>

        <!--  start nav-outer-repeat................................................................................................. START -->
        <div class="nav-outer-repeat"> 
            <!--  start nav-outer -->
            <div class="nav-outer"> 

                <!-- start nav-right -->
                <div id="nav-right">

                    <div class="nav-divider">&nbsp;</div>
                    <a class= "btn btn-default" href="<%=request.getContextPath()%>/login.jsp" id="logout"><img src="images/shared/nav/nav_logout.gif" width="64" height="14" alt="" /></a>
                    <div class="clear">&nbsp;</div>

                </div>
                <!-- end nav-right -->


                <!--  start nav -->
                <div class="nav">
                    <div class="table">

                        <ul class="current"><li><a href="index.jsp"><b>Home</b><!--[if IE 7]><!--></a><!--<![endif]-->
                                <!--[if lte IE 6]><table><tr><td><![endif]-->

                                <!--[if lte IE 6]></td></tr></table></a><![endif]-->
                            </li>
                        </ul>


                        <div class="nav-divider">&nbsp;</div>

                        <ul class="select"><li><a href=""><b>Senjata</b><!--[if IE 7]><!--></a><!--<![endif]-->
                                <!--[if lte IE 6]><table><tr><td><![endif]-->
                                <div class="select_sub">
                                    <ul class="sub">
                                        <li><a href="tambahRekap.jsp">Tambah Data</a></li>
                                        <li><a href="rekapPeminjam.jsp">Rekap Data Senjata</a></li>
                                        <li><a href="#nogo">Edit Data Senjata</a></li>
                                    </ul>
                                </div>
                                <!--[if lte IE 6]></td></tr></table></a><![endif]-->
                            </li>
                        </ul>


                        <div class="nav-divider">&nbsp;</div>

                        <ul class="select"><li><a href=""><b>Senjata1</b><!--[if IE 7]><!--></a><!--<![endif]-->
                                <!--[if lte IE 6]><table><tr><td><![endif]-->
                                <div class="select_sub">
                                    <ul class="sub">
                                        <li><a href="tambahRekap1.jsp">Tambah Data1</a></li>
                                        <li><a href="rekapPeminjam.jsp">Rekap Data Senjata1</a></li>
                                        <li><a href="#nogo">Edit Data Senjata</a></li>
                                    </ul>
                                </div>
                                <!--[if lte IE 6]></td></tr></table></a><![endif]-->
                            </li>
                        </ul>



                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
                <!--  start nav -->

            </div>


            <div class="clear"></div>
            <!--  start nav-outer -->
        </div>
        <!--  start nav-outer-repeat................................................... END -->

        <div class="clear"></div>

        <!-- start content-outer -->
        <div id="content-outer">
            <!-- start content -->
            <div id="content">


                <div id="page-heading"><h1>Tambah Data Senjata</h1></div>


                <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
                    <tr>
                        <th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                        <th class="topleft"></th>
                        <td id="tbl-border-top">&nbsp;</td>
                        <th class="topright"></th>
                        <th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
                    </tr>
                    <tr>
                        <td id="tbl-border-left"></td>
                        <td>
                            <!--  start content-table-inner -->
                            <div id="content-table-inner">

                                <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                    <tr valign="top">
                                        <td>


                                            <!--  start step-holder -->
                                            <div id="step-holder">
                                                <div class="step-no">1</div>
                                                <div class="step-dark-left"><a href="">Add product details</a></div>
                                                <div class="step-dark-right">&nbsp;</div>
                                                <div class="step-no-off">2</div>
                                                <div class="step-light-left">Select related products</div>
                                                <div class="step-light-right">&nbsp;</div>
                                                <div class="step-no-off">3</div>
                                                <div class="step-light-left">Preview</div>
                                                <div class="step-light-round">&nbsp;</div>
                                                <div class="clear"></div>
                                            </div>
                                            <!--  end step-holder -->

                                            <!-- start id-form -->
                                            <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                                                <form method="post" action="ControllerServlet">

                                                    <tr>
                                                        <th valign="top">ID Senjata :</th>
                                                        <td><INPUT TYPE="text" NAME="idSenjata" value="<%=bean.getIdSenjata()%>"></td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">Nama Senjata :</th>
                                                        <td><INPUT TYPE="text" NAME="namaSenjata" value="<%=bean.getNamaSenjata()%>" ></td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">Tipe Senjata :</th>
                                                        <td>	
                                                            <select name='jenis' onchange="showJenis(this.value)">  
                                                                <option value="<%= bean.getJenis()%>"><%= bean.getJenis()%></option>  

                                                                <%
                                                                    DBClass dbobject = new DBClass();
                                                                    List list = dbobject.getJenis();
                                                                    request.setAttribute("list", list);
                                                                    List list2 = (List) request.getAttribute("list");
                                                                    if (list2 != null) {
                                                                        for (int i = 0; i < list2.size(); i++) {
                                                                            UserBean ubean = (UserBean) list2.get(i);
                                                                %>
                                                                <option value="<%=ubean.getIdJenis()%>"><%= ubean.getNamaJenis()%></option>  
                                                                <%
                                                                        }
                                                                    }
                                                                %>
                                                            </select>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">Inventory :</th>
                                                        <td>	
                                                            <select name='idGudang' onchange="showGudang(this.value)">  
                                                                <!--                                <option value="none">Select</option>  -->
                                                                <option value="<%= bean.getIdGudang()%>"><%= bean.getIdGudang()%></option>  
                                                                <%
                                                                    DBClass dbobject2 = new DBClass();
                                                                    List list3 = dbobject2.getGudang();
                                                                    request.setAttribute("list", list3);
                                                                    List list4 = (List) request.getAttribute("list");
                                                                    if (list4 != null) {
                                                                        for (int i = 0; i < list4.size(); i++) {
                                                                            UserBean ubean = (UserBean) list4.get(i);
                                                                %>

                                                                <option value="<%=ubean.getIdGgudang()%>"><%= ubean.getNamaGudang()%></option>  
                                                                <%
                                                                        }
                                                                    }
                                                                %>
                                                            </select>
                                                        </td>
                                                        <td></td>
                                                    </tr> 

                                                    <tr>
                                                        <th valign="top">Tahun Pembuatan :</th>
                                                        <td><INPUT TYPE="text" NAME="thnDibuat" value="<%=bean.getThnDibuat()%>"></td>
                                                        <td></td>
                                                    </tr>


                                                    <tr>
                                                        <th valign="top">Tahun Pembelian :</th>
                                                        <td><INPUT TYPE="text" NAME="thnDibeli" value="<%=bean.getThnDibeli()%>"></td>
                                                        <td></td>
                                                    </tr>



                                                    <tr>
                                                        <th valign="top">Status Senjata :</th>
                                                        <td>
                                                            <select name='status' onchange="showStatus(this.value)">  
                                                                <option value="<%= bean.getStatus()%>"><%= bean.getStatus()%></option>  

                                                                <%
                                                                    DBClass dbobject3 = new DBClass();
                                                                    List list6 = dbobject3.getStatus();
                                                                    request.setAttribute("list", list6);
                                                                    List list7 = (List) request.getAttribute("list");
                                                                    if (list7 != null) {
                                                                        for (int i = 0; i < list7.size(); i++) {
                                                                            UserBean ubean = (UserBean) list7.get(i);
                                                                %>
                                                                <option value="<%=ubean.getIdStatus()%>"><%= ubean.getNamaStatus()%></option>  
                                                                <%
                                                                        }
                                                                    }
                                                                %>
                                                            </select>

                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                    <TR>
                                                        <TD colspan="2" align="center">

                                                            <INPUT TYPE="submit" class="btn btn-primary" value="<%=bean.getAction()%>" name="action"></input>

                                                            <a class="btn btn-default" href="ControllerServlet?action=cancel2">Cancel</a>

                                                        </TD>
                                                        <TD>
                                                            &nbsp;
                                                        </TD>
                                                    </TR>
                                                </form>
                                            </table>
                                            <!-- end id-form  -->

                                    <tr>
                                        <td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
                                        <td></td>
                                    </tr>
                                </table>

                                <div class="clear"></div>


                            </div>
                            <!--  end content-table-inner  -->
                        </td>
                        <td id="tbl-border-right"></td>
                    </tr>
                    <tr>
                        <th class="sized bottomleft"></th>
                        <td id="tbl-border-bottom">&nbsp;</td>
                        <th class="sized bottomright"></th>
                    </tr>
                </table>


                <div class="clear">&nbsp;</div>

            </div>
            <!--  end content -->
            <div class="clear">&nbsp;</div>
        </div>
        <!--  end content-outer -->



        <div class="clear">&nbsp;</div>

        <!-- start footer -->         
        <div id="footer">
            <!--  start footer-left -->
            <div id="footer-left">
                Admin Skin &copy; Copyright Internet Dreams Ltd. <a href="">www.netdreams.co.uk</a>. All rights reserved.</div>
            <!--  end footer-left -->
            <div class="clear">&nbsp;</div>
        </div>
        <!-- end footer -->

    </body>
</html>   


